from selenium import webdriver
from selenium.webdriver.common.by import By


def swtich_to(driver: webdriver.Chrome):
    handles = driver.window_handles
    for handle in handles:
        if handle != driver.current_window_handle:
            driver.close()
            driver.switch_to.window(handle)
            return driver
    return driver
